
#ifndef IMGFCN_H
#define IMGFCN_H

#include <QImage>
#include <QDebug>
#include <vector>
#include <iostream>
using namespace std;

enum ConvType {Standard, Transposed};
enum PoolType {Max, Mean};

struct ConvKernel
{
    vector<vector<int>> Kernel; //卷积核
    ConvType Type;//卷积类型
    int X;//横向大小
    int Y;//竖向大小
};

struct PoolKernel
{
    PoolType Type;//池化类型
    int X;//滤波器水平大小
    int Y;//滤波器竖直大小
};

struct PoolRes
{
    vector<vector<double>> PoolImg;
    vector<vector<double>> PoolTemp;
};

struct Stride
{
    int X;//水平步长
    int Y;//竖直步长
};

class ImgFcn
{

public:
    ImgFcn(QImage *m_Img1);
    vector<vector<double>> imgCovn(vector<vector<double>> Img, ConvKernel convKernel, Stride stride = {1, 1});//图像卷积
    PoolRes imgPool(vector<vector<double>> Img, PoolKernel poolKernel = {Max, 2, 2}, Stride stride = {2, 2});//图像池化
    //vector<vector<double>> imgDecCovn();//反卷积
    vector<vector<double>> imgDecPool(vector<vector<double>> PoolImg, vector<vector<double>> PoolTemp, PoolKernel poolKernel = {Max, 2, 2});//反池化

    vector<vector<double>> fcn(vector<vector<double>> Img);
    QImage *imgFCN();

private:
    QImage *m_Img;

};

#endif // IMGFCN_H
